/*
 * @描述: 
 * @创建者: kilomChou
 * @Date: 2020-11-21 16:37:53
 * @最后编辑: kilomChou
 * @LastEditTime: 2021-04-27 23:06:14
 */
import buildTsProtoCode from "./builder/TsProtoCodeBuilder";

let dir = ""
let out = ""
let clsName = ""
let flag = ""

process.argv.forEach(opt => {
    if (flag == "i") {
        flag = ""
        dir = opt
        return
    }
    if (flag == "o") {
        flag = ""
        out = opt
        return
    }
    if (flag == "n") {
        flag = ""
        clsName = opt
        return
    }
    if (opt.includes("-i")) {
        flag = "i"
    } else if (opt.includes("-o")) {
        flag = "o"
    } else if (opt.includes("-n")) {
        flag = "n"
    }
})

if (dir && out) {
    buildTsProtoCode(dir, out, clsName)
} else {
    console.log("请输入协议目录和代码导出目录");
}